package cn.yudao.ymcc.web.controller;

import cn.yudao.ymcc.result.JSONResult;
import cn.yudao.ymcc.service.ICreateOrderTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CreateOrderTokenController {

    @Autowired
    private ICreateOrderTokenService createOrderTokenService;

    /**
    * @Title: createToken
    * @Description: 获取订单的唯一token
    * @Author: Mr.Jia
    * @Version: 1.0
    * @Date:  2022/8/17 17:22
    * @Parameters:
    * @Return
    */
    @RequestMapping(value = "/createToken/{courseId}",method = RequestMethod.GET)
    public JSONResult createToken(@PathVariable("courseId")String courseId){
        String token = createOrderTokenService.createToken(courseId);
        return JSONResult.success(token);
    }

}
